<template>
    <template v-if="!resultData.finished">
        <el-skeleton  :rows="5" animated />
    </template>
     <template v-if="resultData.finished">
        <el-row style="height: 13px;">
        <el-col class="SubInfo" :span="16">无恙 提交于 2023.11.02 17:03</el-col>
     </el-row>
     <el-divider />
     <div v-if="resultData.status_code!='0'">
        <el-row>
         <el-col :span="8" class="success-sub" v-if="resultData.status_code=='1'"><span style="color: rgb(20, 221, 20);">恭喜通过</span></el-col>
        </el-row>
    <el-row gutter="50">
            <el-col :span="12" >
                <el-card class="box-card">
                    <el-space direction="vertical">
                        <span>消耗时间：{{ (resultData.status_runtime*1000).toFixed(2)+'ms' }}</span>
                    </el-space>

                   
                </el-card>
            </el-col>
            <el-col :span="12" >
                <el-card class="box-card">
                    <span>消耗内存：{{(resultData.memory/1000).toFixed(2)}}MB</span>
                </el-card>
            </el-col>
        </el-row>

<pre>  代码:</pre>

        <el-card >
            <n-code :code="code" language="js" word-wrap />
        </el-card>
     </div>
     <div v-if="resultData.status_code=='0'">
        <el-row >
         <el-col :span="16" class="success-sub"><span style="color:red">错误!</span> 
            <el-divider direction="vertical"  />
            <span style="font-size: 12px;">0 / 60 个通过的测试用例</span>
         </el-col>
        </el-row>
        <el-card>
            {{ resultData.compare_result }}
        </el-card>
<pre>  代码</pre>

<el-card class="box-card">
    <n-code :code="code" language="js" word-wrap />
  </el-card>
     </div>
     </template>
     
    
  
</template>

<script setup>
import { onMounted,reactive,computed,defineProps,toRefs} from "vue"
import { mainStore } from "@/store";
import {JudgeResponse} from "@/pojo/entity"


const props = defineProps({
  //子组件接收父组件传递过来的值
  result: JudgeResponse,
})

//使用父组件传递过来的值
const {result} =toRefs(props)

//创建变量JudgeResponse
const resultData=computed(()=>result.value)


let code= `
function padEnd(string, length, chars) {
  const strLength = length ? stringSize(string) : 0
  return (length && strLength < length)? (string + createPadding(length - strLength, chars)): (string || '')
}
      `



</script>

<style scoped>

    .SubInfo{
        font-size: 12px;
        text-align: left;
    }
    .success-sub{
        font-size: 20px;
        text-align: left; 
    }
    .box-card{
        height: 100px;
    }

</style>